$(function(){
	$("#userName").blur(function(){
		var name = $(this).val();
		if(name == ""){
			swal("用户名不能为空")
		}else if(name.length>10){
			swal("用户名不能大于10位数");
		}else{
			var url = "../../user/findName.action";
			var data={"userName":$(this).val()};
			$.post(url,data,function(mes){
				if(mes.state == 0){
					swal('sorry！','用户不存在,请注册','error')
				}else{
					
				}
			},"json")
		}
	})
	$("#loginSubmit").click(function(){
		var url = "../../user/queryNameOrPwd.action";
		var data = $("#myForm").serialize();
		$.post(url,data,function(mes){
			if(mes.state==1){
				location.href="../Map/index.html";
			}else{
				swal('sorry！','用户名或者密码错误','error')
			}
		},"json")
	})
})